<template>
	<view>
		<view class="top-swiper">
			<!-- 			 <view class="bg">
				 <view class="placeholder"></view>
				 <view class="image">
					 <image :src="swiper.list[swiper.index]" mode="aspectFill"></image>
				 </view>
			 </view> -->
			<view class="box">
				<swiper class="swiper" :previous-margin="swiper.margin" :next-margin='swiper.margin' :circular="true"
					@change="swiperChange">
					<swiper-item v-for="(item,index) in list" :key="index">
						<image class='le-img' mode="aspectFill" :src="getImg(item.image)" :class="{'le-active':swiper.index == index}"></image>
					</swiper-item>
				</swiper>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: [],
			}
		},
		data() {
			return {
				swiper: {
					margin: "150rpx",
					index: 0
				}
			}
		},
		components: {

		},
		mounted() {

		},
		methods: {
			//swiper滑动事件
			swiperChange: function(e) {
				this.swiper.index = e.detail.current;
				this.$emit('swiperChange',this.swiper.index)
			},
		}
	}
</script>

<style lang="scss">
	.top-swiper {
		margin-bottom: 30rpx;
		// background-color: rgb(28, 12, 32);

		.box {
			width: 100%;
			height: auto;
		}

		.swiper {
			height: 500rpx;
			margin: 0 20rpx;

			.le-img {
				width: 100%;
				height: 500rpx;
				display: block;
				transform: scale(0.6);
				transition: transform 0.3s ease-in-out 0s;
				border-radius: 4px;
				opacity: 0.5;
				// background: #eee;
				&.le-active {
					transform: scale(.8);
					opacity: 1;
				}
			}

		}
	}
</style>